function fulleditor(id){
	tinyMCE.init({
		theme : "advanced",
		mode : "exact",
		elements : id,
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		relative_urls : false,
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_fonts:"Microsoft Yahei=Microsoft Yahei,Tahoma=Tahoma,Simsun=Simsun,宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书=隶书;幼圆=幼圆; Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings",
		style_formats : [
     		{title : 'Bold text', inline : 'b'},
     		{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
     		{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
     		{title : 'Table styles'},
     		{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
     	],
     	force_br_newlines : true,
     	force_p_newlines : false
	});

}
function isImg(filename){
	var suffix = filename.substring(filename.lastIndexOf('.'));
	if(suffix==".gif"||suffix==".png"||suffix==".jpg"){
		return true;
	}
}
function addImg(data){
	var imgstr = "<img src='/"+data.location+"'/>";
	tinyMCE.execCommand('mceInsertContent',false,imgstr);
}
function insertImg(imgurl){
	var imgstr = "<img src='/"+imgurl+"'/>";
	tinyMCE.execCommand('mceInsertContent',false,imgstr);
}